import request from '@/utils/request'
import { baseUrl } from '@/config/env';

export const getDeptTree = () => {
  return request({
    url: baseUrl+'/rest/dept/tree',
    method: 'post'
  })
}

export const getList = (page, size, params) => {
  return request({
    url: baseUrl+'/rest/dept/list',
    method: 'get',
    params: {
      ...params,
      page,
      size,
    }
  })
}
export const remove = (deptId) => {
  return request({
    url: baseUrl+'/rest/dept/delete',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      deptId,
    }
  })
}

export const add = (row) => {
  return request({
    url: baseUrl+'/rest/dept/add',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const update = (row) => {
  return request({
    url: baseUrl+'/rest/dept/update',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const getDept = (deptId) => {
  return request({
    url: `${baseUrl}/rest/dept/view/${deptId}`,
    method: 'post',
    meta: {
      isSerialize: true,
    }
  })
}